package com.care.doctor.remote.factory;

import com.care.common.core.domain.Result;
import com.care.doctor.common.domain.DTODoctorType;
import com.care.doctor.common.req.ListReq;
import com.care.doctor.remote.DoctorTypeRemoteService;
import com.github.pagehelper.PageInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @Author: 靳家振
 * @Date: 2024/3/24 08:53
 * @Description:
 **/

@Component
public class RemoteDoctorTypeServiceFallback implements FallbackFactory<DoctorTypeRemoteService>{
    public static final Logger logger = LoggerFactory.getLogger(RemoteDoctorTypeServiceFallback.class);
    @Override
    public DoctorTypeRemoteService create(Throwable cause) {
        logger.error("调用医生级别接口异常：{}", cause.getMessage ());
        return new DoctorTypeRemoteService () {
            @Override
            public Result<PageInfo<DTODoctorType>> findDoctorType(ListReq req) {
                return Result.error ("医生级别接口异常，请联系管理员整一下");
            }
        };
    }
}
